package com.byxy.managerial.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
 * 部门实体类
 */
@Entity
@Table(name = "m_department")
public class Department implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue // id主键自增
	private Integer id;
	@Column(name = "dname", length = 10) // 部门名称,长度10
	private String dname;
	@Column(name = "depint") // 部门介绍
	private String depint;
	@Column(name = "dprincipal", length = 10) // 部门负责人,长度10
	private String principal;
	
	@OneToMany(targetEntity = Staff.class,mappedBy = "depart") // 部门员工集合:关联关系映射
	private Set<Staff> staff = new HashSet<Staff>();

	public Department() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDname() {
		return dname;
	}

	public void setDname(String dname) {
		this.dname = dname;
	}

	public String getDepint() {
		return depint;
	}

	public void setDepint(String depint) {
		this.depint = depint;
	}

	public String getPrincipal() {
		return principal;
	}

	public void setPrincipal(String principal) {
		this.principal = principal;
	}

	public Department(String dname, String depint, String principal) {
		super();
		this.dname = dname;
		this.depint = depint;
		this.principal = principal;
	}

	public Set<Staff> getStaff() {
		return staff;
	}

	public void setStaff(Set<Staff> staff) {
		this.staff = staff;
	}
	
	
}
